n = int(input())
min = 1000
max = 1
for i in range(n):
    a = int(input())
    if a < min:
        min = a
    if a > max:
        max = a
print(max-min)
